package com.yjt.fresh.adpater;

import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yjt.fresh.R;
import com.yjt.fresh.bean.BeanMyCard;

import java.util.List;

/**
 * 我的购物卡
 * Created by mcc on 2018/6/10.
 */

public class AdpRvAtyMyCard extends BaseQuickAdapter<BeanMyCard, BaseViewHolder> {
    private boolean isUse;

    public boolean isUse() {
        return isUse;
    }

    public void setUse(boolean use) {
        isUse = use;
    }

    public AdpRvAtyMyCard(int layoutResId, @Nullable List<BeanMyCard> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BeanMyCard item) {
        helper.setText(R.id.tvAppRecycleItemMyCardPassword, item.getPASSWORD());
        if (!isUse) {
            helper.setText(R.id.tvAppRecycleItemMyCardTime, "购买日期:"+item.getCREATE_TIME());
            helper.getView(R.id.tvAppRecycleItemMyCardCopy).setVisibility(View.VISIBLE);
        }else {
            helper.getView(R.id.tvAppRecycleItemMyCardCopy).setVisibility(View.GONE);
            helper.setText(R.id.tvAppRecycleItemMyCardTime, "购买日期:"+item.getCREATE_TIME());
        }
        helper.setText(R.id.tvAppRecycleItemMyCardMoney, item.getMONEY());
        helper.addOnClickListener(R.id.tvAppRecycleItemMyCardCopy);
    }
}
